import java.util.Arrays;

public class MyStack {
    private int[] arr;
    private int size;
    public MyStack() {
        this.arr = new int[10];
    }
    private boolean isfull(){
        if(arr.length==size){
            return true;
        }
        return false;
    }

    public int push(int val){
        if(isfull()){
            arr= Arrays.copyOf(arr,size*2);
        }
        arr[size++]=val;
        return val;
    }

    public boolean empty(){
        if(size==0){
            return true;
        }
        return false;
    }
    public int pop(){
        if(empty()){
            return -1;
        }
        int ret=arr[size-1];
        size--;
        return ret;
    }

    public int peek(){
        if(empty()){
            return -1;
        }
        return arr[size-1];
    }

    public int size(){
        return size;
    }
}
